<template>
  <div>
    <section style="height:100%;position:relative">
      <div style="height:100%">
        <iframe
          :src="src"
          frameborder="0"
          id="iframe"
          scrolling="no"
          style="border:none;width:100%;height:612px"
        ></iframe>
      </div>
    </section>
  </div>
</template>

<script>
import { getFormViewList } from '@/api/approval';
import { DevPrefixReport } from '@/config/cfg.js';

export default {
  data () {
    return {
      src: ''
    };
  },
  mounted () {
    this.getTableList();
  },
  methods: {
    handleBackClick () {
      this.$router.go(-1);
    },
    async getTableList () {
      const { type, dataid: dataId } = this.$route.query;
      console.log('上一个页面传过来的是啥0', this.$route.query);
      const data = {
        dataId,
        type
      };
      console.info(data);
      const resp = await getFormViewList(data);
      console.info(resp.data.data);
      // eslint-disable-next-line no-unused-vars
      let param = null;
      console.info(type);
      if (type === '4' || type === '5') {
        param = resp.data.data.head;
      } else {
        param = resp.data.data;
      }
      const { url, filename, dataId: _dataId, nodeId, filetype, reportId,
        token } = param;
      if (filetype == 1) {
        this.src = `${DevPrefixReport + url}showReportGroup.jsp?rpg=/view/${filename}_zu.rpg&arg1=${_dataId}&pid=${nodeId},${reportId}&token=${token}&tid=1`;
      } else {
        this.src = `${DevPrefixReport + url}showReport.jsp?rpx=/view/${filename}_view.rpx&arg1=${_dataId}&pid=${nodeId},${reportId}&token=${token}&tid=1`;
      }
    }
  }
};
</script>

<style lang="less" scoped >
.main .content-wrapper {
  overflow-x: hidden;
}
</style>
